Titanium.include("/makan/model/functions.js");
mapDialog.addEventListener('click',function(e) {
	var index = e.index ;
	switch(index) {
		case 0.0 :
		//alert("fol");
		break;
		case 1.0 :
		//alert("eshta");
		break;
	} 
});


mapview.addEventListener('complete',function() {
	//alert("complete");
});
mapview.addEventListener('dblclick',function() {
	//alert("dblclick");
});
mapview.addEventListener('regionChanged',function() {	
	//alert("regionChanged");
});
mapview.addEventListener('touchend',function() {
	//alert("touchend");
});
mapview.addEventListener('touchstart',function() {
	//alert("touchstart");
});

mapview.addEventListener('touchmove',function() {
	//alert("touchmove");
});
mapview.addEventListener('swipe',function() {
	//alert("swipe");
});
mapview.addEventListener('click',function(evt)
{
	if(checkIfAnnotated(evt.x,evt.y,latArr,longArr)) {
		mapDialog.show();
	}else {
		mapDialog.show();
	}
});



searchText.addEventListener('click',function() {
	//searchDialog.show();
	alert(T("app-name"));
});
searchText.addEventListener('focus',function() {
	//searchDialog.show();
});

searchButton.addEventListener('click',function() {
/*
var mail = "amrnegm.01@gmail.com";
var pass='123';
alert(mail);
var url ='http://10.0.2.1:8000/emakan/default/call/xmlrpc';
var method = 'xAuth';
var params =[mail, pass];
xmlrpc(url,method,params, function(){
	alert(this.responseText);
});

*/
alert("testing");
	var xhr = Titanium.Network.createHTTPClient();
    xhr.open("GET","http://192.168.1.10:8000/emakan/default/call/json?email=asayed&password=123");
    //xhr.onload = alert(xhr.responseText);
    
    var jsonClient ='{"jsonrpc":"2.0","method":"xAuth","params":["email":"amrnegm.01@gmail.com","password":"123"],"id":2}';
    //alert(jsonClient);
	xhr.send();
	alert(xhr.responseText);
	alert(xhr.readyState);
	/*
alert("testingagain");
var mail = "amrnegm.01@gmail.com";
var pass='123';
var url ='http://192.168.1.10:8000/emakan/default/call/xmlrpc';
var method = 'xAuth';
var params =[mail, pass];
jsonRPC(url,method,params,1, function(){
	alert(this.responseText);
});
*/
});
